package com.mm.cloud.common.redis.constant;

import com.mm.cloud.common.redis.constant.base.RedisKeyNamespace;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.concurrent.TimeUnit;

/**
 * Redis短信相关缓存Key
 *
 * @author mr
 * @since 2021-06-09
 */
public class RedisKeySmsConstants extends RedisKeyNamespace {

    /**
     * 短信命名空间
     */
    public static final String REDIS_SMS = REDIS_NAMESPACE + "SMS:";

    /**
     * 短信登录验证码
     */
    public static final String REDIS_LOGIN_CODE = REDIS_SMS + "LOGINCODE";


    /**
     * Redis短信相关缓存时间
     *
     * @author mr
     * @since 2021-06-09
     */
    @Getter
    @AllArgsConstructor
    public enum RedisCacheTimeEnum {

        LOGIN_CODE(300L, TimeUnit.SECONDS, "验证码已失效");

        /**
         * 时长
         */
        private final Long time;

        /**
         * 单位
         */
        private final TimeUnit unit;

        /**
         * 超时说明
         */
        private final String note;
    }
}
